<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <script src="../jQuery-3.6.3.min.js"> </script>
    <script>
        $(function () {
            var str = "   不良帅       ";
            console.log("开始长度：" + str.length);
            var str = $.trim(str);
            console.log("返回后的长度：" + str.length);
        })
    </script>
</head>

<body>

</body>

</html>